﻿@{
    Layout = "~/Areas/Admin/Views/Shared/_AdminPopupLayout.cshtml";
    //page title
    ViewBag.Title = T("Admin.Orders.Fields.PartialRefund").Text;
}
@model OrderModel

<form asp-controller="Order" asp-action="PartiallyRefundOrderPopup" method="post"
      asp-route-OrderId="@Context.Request.Query["OrderId"]"
      asp-route-btnId="@Context.Request.Query["btnId"]"
      asp-route-online="@Context.Request.Query["online"]"
      asp-route-formId="@Context.Request.Query["formId"]"
      >
    
    <div class="row">
        <div class="col-md-12">
            <div class="x_panel light form-fit">
                <div class="x_title">
                    <div class="caption">
                        <i class="fa fa-tag"></i>
                        @T("Admin.Orders.Fields.PartialRefund")
                    </div>
                </div>
                <vc:admin-widget widget-zone="order_partially_refund_buttons" additional-data="Model" />
                <div class="note note-info">
                    <strong>
                        @string.Format(T("Admin.Orders.Fields.PartialRefund.OrderInfo").Text, Model.Id)
                    </strong>
                </div>
                <div class="x_content form">
                    <div class="form-horizontal">
                        <div class="form-body">
                            <div class="form-group">
                                <admin-label asp-for="AmountToRefund" />
                                <div class="col-md-9 col-sm-9">
                                    <admin-input asp-for="AmountToRefund" />: &nbsp;&nbsp;&nbsp; <span style="white-space: nowrap">
                                        @string.Format(T("Admin.Orders.Fields.PartialRefund.AmountToRefund.Max").Text, Model.MaxAmountToRefund.ToString("G29"), Model.PrimaryStoreCurrencyCode)
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-actions">
                            <input type="submit" name="partialrefundorder" value="@T("Admin.Orders.Fields.Refund")" id="partialrefundorder" class="btn default" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div asp-validation-summary="All"></div>
    @if (ViewBag.RefreshPage == true)
    {
        <script type="text/javascript">
            try {window.opener.document.forms['@(Context.Request.Query["formId"])'].@(Context.Request.Query["btnId"]).click();}
            catch (e){}
            window.close();
        </script>
    }
</form>